<template>
  <div class="order-details">
    <!-- 订单状态 -->
    <div class="status-bar">
      <h3>已取消</h3>
    </div>

    <!-- 用户信息 -->
    <div class="user-info">
      <p>亮亮 186****1688</p>
      <p>地址：广东省深圳市南山区西丽镇沙河西路12号丽新花园6栋1502号</p>
    </div>

    <!-- 商品列表 -->
    <div class="product-list">
      <div class="product-item" v-for="(product, index) in products" :key="index">
        <img :src="product.image" alt="Product Image">
        <div class="product-details">
          <h4>{{ product.name }}</h4>
          <p class="product-spec">商品属性规格</p>
          <p class="product-price">¥{{ product.price }}</p>
        </div>
        <span class="product-quantity">x{{ product.quantity }}</span>
      </div>
    </div>

    <!-- 订单信息 -->
    <div class="order-info">
      <div class="info-row">
        <span>订单编号：</span>
        <span>2539129895</span>
      </div>
      <div class="info-row">
        <span>下单时间：</span>
        <span>2018.08.18 18:08</span>
      </div>
      <div class="info-row">
        <span>支付方式：</span>
        <span>支付宝</span>
      </div>
      <div class="info-row">
        <span>商品合计</span>
        <span>¥200.00</span>
      </div>
      <div class="info-row">
        <span>活动优惠</span>
        <span class="discount">-¥12.00</span>
      </div>
      <div class="info-row">
        <span>优惠券</span>
        <span class="discount">-¥20.00</span>
      </div>
      <div class="info-row">
        <span>运费</span>
        <span>+¥0.00</span>
      </div>
      <div class="info-row total">
        <span>实付款：</span>
        <span>¥168.00</span>
      </div>
    </div>

    <!-- 客服信息 -->
    <div class="customer-service">
      <p>服务时间：9:00-24:00</p>
      <div class="service-buttons">
        <button class="service-btn">在线客服</button>
        <button class="service-btn">电话客服</button>
      </div>
    </div>

    <!-- 推荐商品 -->
    <div class="recommended-products">
      <h3>为你推荐</h3>
      <div class="product-grid">
        <div class="product-item" v-for="(product, index) in recommendedProducts" :key="index">
          <img :src="product.image" alt="Product Image">
          <p class="product-name">{{ product.name }}</p>
          <p class="product-price">¥{{ product.price }}</p>
        </div>
      </div>
    </div>

    <!-- 底部按钮 -->
    <div class="bottom-buttons">
      <button class="pay-btn" @click="returnbuy">再次购买</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      products: [
        {
          image: 'static/swy/p0.jpg',
          name: '甜美V领荷叶袖T恤',
          price: 39,
          quantity: 1
        },
        {
          image: 'static/swy/p0.jpg',
          name: '时尚蕾丝短袖衬衣',
          price: 50,
          quantity: 1
        },
        {
          image: 'static/swy/p0.jpg',
          name: '钩花蕾丝衬衣',
          price: 79,
          quantity: 1
        }
      ],
      recommendedProducts: [
        {
          image: 'static/swy/p0.jpg',
          name: '钩花蕾丝衬衣',
          price: 188
        },
        {
          image: 'static/swy/p0.jpg',
          name: '时尚甜美蕾丝短袖衬衣',
          price: 378
        },
        {
          image: 'static/swy/p0.jpg',
          name: '优雅时尚露肩衬衣',
          price: 437
        },
        {
          image: 'static/swy/p0.jpg',
          name: '小清新喇叭袖针织衫',
          price: 297
        }
      ]
    };
  },
  methods:{
	  returnbuy(){
	  		  uni.switchTab({
	  		    url: '/pages/cart/cart'
	  		  });
	  }
  }
};
</script>

<style scoped>
.order-details {
  font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  color: #333;
  padding-bottom: 70px;
  background-color: #f5f5f5;
}

.status-bar {
  background-color: #FF9500;
  color: white;
  padding: 15px;
  text-align: center;
  height: 52px;
}

.status-bar h3 {
  margin: 0;
  font-size: 18px;
  padding: 16px;
  font-weight: 500;
}

.status-bar p {
  margin: 5px 0 0;
  font-size: 14px;
}

.user-info {
  margin: 10px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-info p {
  margin: 5px 0;
  font-size: 14px;
  line-height: 1.4;
}

.product-list {
  margin: 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.product-item:last-child {
  border-bottom: none;
}

.product-item img {
  width: 70px;
  height: 70px;
  border-radius: 4px;
  object-fit: cover;
  margin-right: 12px;
}

.product-details {
  flex: 1;
}

.product-details h4 {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 500;
}

.product-spec {
  margin: 0 0 5px;
  font-size: 12px;
  color: #999;
}

.product-price {
  margin: 0;
  font-size: 15px;
  color: #FF9500;
  font-weight: 500;
}

.product-quantity {
  color: #666;
  font-size: 14px;
}

.order-info {
  margin: 10px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.discount {
  color: #FF9500;
}

.total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  font-weight: 500;
  color: #333;
}

.customer-service {
  margin: 10px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  text-align: center;
}

.customer-service p {
  margin: 0 0 15px;
  font-size: 14px;
  color: #666;
}

.service-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.service-btn {
  padding: 4px 20px;
  border: 1px solid #FF9500;
  border-radius: 20px;
  background: white;
  color: #FF9500;
  font-size: 14px;
  height: 30px;
  line-height: 22px;
}

.recommended-products {
  margin: 10px;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.recommended-products h3 {
  margin: 0 0 15px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.recommended-products .product-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: none;
}

.recommended-products img {
  width: 100%;
  height: 150px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.product-name {
  margin: 0 0 5px;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 36px;
  line-height: 18px;
}

.bottom-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  padding: 10px;
  background: white;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
}

.pay-btn {
  padding: 4px 25px;
  border: none;
  border-radius: 4px;
  background: #FF9500;
  color: white;
  font-size: 14px;
  height: 30px;
  line-height: 22px;
  margin-left: auto; /* 确保按钮靠右 */
}
</style>